<!DOCTYPE html>
<html <?php language_attributes(); ?>>
	<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="HandheldFriendly" content="True">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title><?php if (is_single() || is_page() || is_archive() || is_search()) { ?><?php wp_title('',true); ?> - <?php } bloginfo('name'); ?><?php if ( is_home() ){ ?> - <?php bloginfo('description'); ?><?php } ?><?php if ( is_paged() ){ ?> - <?php printf( __('Page %1$s of %2$s', ''), intval( get_query_var('paged')), $wp_query->max_num_pages); ?><?php } ?></title>
	<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/style.css">
  	<!--[if lt IE 9]>
    	<script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    	<script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
 	 <![endif]-->
	<!--[if lte IE 8]><script>window.location.href='http://www.mywpku.com/upgrade-your-browser.html?referrer='+location.href;</script><![endif]-->
  <?php 
  if (is_home()){
    $description =  of_get_option( 'description', 'no entry' );
    $keywords =  of_get_option( 'keywords', 'no entry' );
  } elseif (is_single() || is_page()){    
    $description1 =  $post->post_excerpt ;
    $description2 = mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 200, "…");
    $description = $description1 ? $description1 : $description2;
    $keywords = "";        
    $tags = wp_get_post_tags($post->ID);
    foreach ($tags as $tag ) {
      $keywords = $keywords . $tag->name . ", ";
    }
  } elseif(is_category()){
    $description     = strip_tags(category_description());
    $current_category = single_cat_title("", false);
    $keywords =  $current_category;
  }
  ?>
  <meta name="keywords" content="<?php echo $keywords ?>" />
  <meta name="description" content="<?php echo $description ?>" />
	<?php wp_head(); ?>
	</head>

<body <?php body_class(); ?>
  <div id="container">
    <div id="wrap">
      <header id="header">
        <div id="banner">
        </div>
        <div id="header-outer" class="outer">
          <div id="header-title" class="inner">
            <h1 id="logo-wrap">
              <a href="/" id="logo">
                <?php bloginfo('title'); ?>
              </a>
            </h1>
            <h2 id="subtitle-wrap">
              <a href="/" id="subtitle">
                <?php bloginfo('description'); ?>
              </a>
            </h2>
          </div>
          <div id="header-inner" class="inner">
            <nav id="main-nav">
              <a id="main-nav-toggle" class="nav-icon">
              </a>
              <ul class="main-nav-ul">
                <?php wp_nav_menu(array('container' => false, 'items_wrap' => '%3$s', 'theme_location' => 'main-nav')); ?>
              </ul>
            </nav>
            <nav id="sub-nav">
              <a id="nav-rss-link" class="nav-icon" href="<?php bloginfo('rss2_url'); ?>" title="RSS Feed">
              </a>
              <a id="nav-search-btn" class="nav-icon" title="Search">
              </a>
            </nav>
            <div id="search-form-wrap">
              <form action="<?php bloginfo('url'); ?>/" method="get" accept-charset="utf-8"
              class="search-form">
                <input type="search" name="s" id="search" maxlength="20" class="search-form-input"
                placeholder="Search">
                <input type="submit" value="" class="search-form-submit">
              </form>
            </div>
          </div>
        </div>
      </header>
